#include <iostream>
#include <sstream>
#include "Cell.h"

using namespace std;

Cell* Cell::GIVE_UP = new Cell(-1, -1);

Cell::Cell(int x, int y) :
		mX(x), mY(y), mStone(NULL) {
}

Cell::Cell(const Cell& cell) :
		mStone(NULL) {
	mX = cell.mX;
	mY = cell.mY;
	if (cell.mStone != NULL) {
		mStone = new Stone(*cell.mStone);
	}
}

Cell::~Cell() {
	delete mStone;
}

void Cell::setStone(int color) {
	mStone = new Stone(color);
}

int Cell::getX() {
	return mX;
}

int Cell::getY() {
	return mY;
}

string Cell::toString() {
	if (mStone == NULL) {
//            return "□";
		return "　";
	}
	return mStone->toString();
}
string Cell::toStringData() {
	stringstream sb;
	sb << "(" << (mX + 1) << "," << (mY + 1) << ")" << toString();
	return sb.str();
}
